package com.junzhiit.nengji.cms.web.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.junzhiit.nengji.cms.service.UserEvaluateService;
import com.junzhiit.nengji.cms.web.vo.DataTablesParamVO;
import com.junzhiit.nengji.cms.web.vo.ResultVO;
import com.junzhiit.nengji.cms.web.vo.UserEvaluateFindVO;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("user/evaluate")
public class UserEvaluateController extends BaseController {
	@Autowired
	UserEvaluateService userEvaluateService;

	@ApiOperation("获取商品评价信息")
	@RequestMapping(method = RequestMethod.GET)
	public Map<String, Object> findAll(DataTablesParamVO dtp, UserEvaluateFindVO userEvaluateFindVO) {
		return userEvaluateService.findAll(dtp, userEvaluateFindVO);
	}

	@ApiOperation("查询商品评价数量")
	@RequestMapping(value = "/count/{goodsId}", method = RequestMethod.GET)
	public ResultVO findEvaluateCount(@PathVariable String goodsId) {
		return userEvaluateService.findEvaluateCount(goodsId);
	}

	@ApiOperation("默认评价")
	@RequestMapping(value = "/default/evaluate", method = RequestMethod.POST)
	public ResultVO defaultEvaluate() {
		return userEvaluateService.defaultEvaluate();
	}
	
	@ApiOperation("评价总分")
	@RequestMapping(value="score",method=RequestMethod.GET)
	public ResultVO getShopEvaluateScore(UserEvaluateFindVO userEvaluateFindVO){
		return userEvaluateService.getShopEvaluateScore(userEvaluateFindVO);
	}
}
